package com.cosc.apgs.param.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.core.env.Profiles;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.service.VendorExtension;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.ArrayList;

/**
 * @author Howl-Xu
 * @version 1.0.0
 * @Description: Swagger配置类
 * @createTime 2020年07月11日 13:58:00
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {

    @Bean
    public Docket createRestApi(){
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                //扫描控制器接口的文件，输出到swagger中
                .apis(RequestHandlerSelectors.basePackage("com.cosc.apgs.param.controller"))
                .paths(PathSelectors.any())
                .build();
    }


    /**
     * 配置Swagger信息apiInfo
     */
    public ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("APGS运维工具后台接口说明")
                .description("2020-11-10完成版本")
                .version("1.0")
                .build();
    }
}
